package Leason3;

import java.util.Scanner;

public class dve {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String name;
		double s;
		
		double biggestSal = 0;
		int mem = 0;
		double smallestSal = Integer.MAX_VALUE;
		int index = 0;
		
		double salarySum = 0;
		
		String[] worker = new String [3];
		double[] salary = new double [3];
		
		for(int i = 0; i< worker.length; i++)
		{
			System.out.println("Enter the name of the worker: ");
		name = sc.next();
		worker[i] = name;
			System.out.println("Enter the salary of the worker: ");
		s = sc.nextDouble();
		salary[i] = s;
			salarySum += s;
			if( salary[i] > biggestSal)
			{
				mem = i;
				biggestSal = salary[i];
			}
			if(salary[i] < smallestSal)
			{
				smallestSal = salary[i];
				index = i;
			}
		}
		
		System.out.println("The worker with biggest salary is " + worker[mem] +" with "+ salary[mem] );
		System.out.println("The worker with smallest salary is " + worker[index]+ " with " + salary[index]);
		System.out.println("The sum of all selaryes is: " + salarySum);
		System.out.println("The avg of the salaryes is: " + (salarySum/3));
		
		
	}

}
